//
//  M1ColumnListCell.m
//  NewMarryU
//
//  Created by Cedar on 2018/7/19.
//  Copyright © 2018年 Cedar. All rights reserved.
//

#import "M1ColumnListCell.h"
#import "M1ColumnModel.h"

@interface M1ColumnListCell ()

@property (nonatomic, strong) UIImageView *m1_bgImage;

@property (nonatomic, strong) UILabel *m1_title;

@property (nonatomic, strong) UILabel *m1_content;

@end

@implementation M1ColumnListCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.contentView.backgroundColor = m1_color(0xF6F8FB);
        [self m1_createUI];
    }
    return self;
}

- (void)setM1_model:(M1ColumnModel *)m1_model{
    [self.m1_bgImage sd_setImageWithURL:[NSURL URLWithString:m1_model.image_url[@"url"]]];
    
    self.m1_title.text = m1_model.title;
    
    self.m1_content.text = m1_model.content;
    
}

- (void) m1_createUI{
    self.m1_bgImage = [[UIImageView alloc] init];
    _m1_bgImage.image = LOAD_LOCAL_IMG(@"bgView");
    _m1_bgImage.contentMode = UIViewContentModeScaleAspectFill;
    _m1_bgImage.clipsToBounds = YES;
    [self.contentView addSubview:_m1_bgImage];
    
    [_m1_bgImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.offset(13);
        make.left.offset(20);
        make.right.offset(-20);
        make.bottom.offset(0);
    }];
    
    _m1_bgImage.layer.cornerRadius = 10.0;
    _m1_bgImage.layer.masksToBounds = YES;
    
    self.m1_title = [[UILabel alloc] init];
    _m1_title.text = @"专区";
    _m1_title.textColor = m1_color(0xFFFFFF);
    _m1_title.font = m1_font(16);
    [self.contentView addSubview:_m1_title];
    
    [_m1_title mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.offset(19 + 13);
        make.left.offset(35);
    }];
    
    self.m1_content = [[UILabel alloc] init];
    _m1_content.text = @"这就是一个看脸的世界...";
    _m1_content.textColor = m1_color(0xFFFFFF);
    _m1_content.font = m1_font(10);
    [self.contentView addSubview:_m1_content];
    
    [_m1_content mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.m1_title.mas_bottom).offset(8);
        make.left.offset(35);
    }];
}


- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
